home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C26 / FormData.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  703 b   |  30 lines

  1. //: C26:FormData.h
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. #include <string>
  7. #include <iostream>
  8. #include <fstream>
  9. #include <vector>
  10. using namespace std;
  11.  
  12. class DataPair : public pair<string, string> {
  13. public:
  14.   DataPair() {}
  15.   DataPair(istream& in) { get(in); }
  16.   DataPair& get(istream& in);
  17.   operator bool() {
  18.     return first.length() != 0;
  19.   }
  20. };
  21.  
  22. class FormData : public vector<DataPair> {
  23. public:
  24.   string filePath, email;
  25.   // Parse the data from a file:
  26.   FormData(char* fileName);
  27.   void dump(ostream& os = cout);
  28.   string operator[](const string& key);
  29. }; ///:~
  30.